﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;
using YourPersonalTrainer.BusinessLayer.Interfaces;

namespace YourPersonalTrainer.BusinessLayer
{
    public class WorkoutTimer : IWorkoutTimer
    {
        System.Timers.Timer m_Timer;
        public WorkoutTimer()
        {
            m_Timer = new System.Timers.Timer(1000);
            m_Timer.Elapsed += new ElapsedEventHandler(TimerElapsed);
        }

        private void TimerElapsed(object source, ElapsedEventArgs e)
        {
            if (Elapsed != null)
            {
                Elapsed();
            }
        }
        #region IWorkoutTimer Members

        public void Start()
        {
            m_Timer.Start();
        }

        public void Stop()
        {
            m_Timer.Stop();
        }

        public Action Elapsed
        {
            get;
            set;
        }

        #endregion
    }
}
